<form  id="submit-form" class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body">

        <div class="layui-form-item">
            <label class="layui-form-label">设备名称</label>
            <div class="layui-input-block">
                <input name="name" value='{$vo.name|default=""}' required placeholder="请输入设备名称" class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">设备ID</label>
            <div class="layui-input-block">
                <input name="equip_id" value='{$vo.equip_id|default=""}' required placeholder="请输入设备ID"
                       class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">通道名称</label>
            <div class="layui-input-block">
                <input name="channel_name" value='{$vo.channel_name|default=""}' required placeholder="请输入通道名称" class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">通道ID</label>
            <div class="layui-input-block">
                <input name="channel_id" value='{$vo.channel_id|default=""}' required placeholder="请输入通道ID"
                       class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否进入</label>
            <div class="layui-input-block">
                <input type="radio" name="is_come" value="1" required title="进" {if isset($vo.status) && $vo.is_come==1 }checked{/if}>
                <input type="radio" name="is_come" value="2" required title="出" {if isset($vo.status) && $vo.is_come==2 }checked{/if}>
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">品牌</label>
            <div class="layui-input-block">
                <input name="band" value='{$vo.band|default=""}'  placeholder="请输入品牌"
                       class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">型号</label>
            <div class="layui-input-block">
                <input name="spec" value='{$vo.spec|default=""}'  placeholder="请输入型号"
                       class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">位置</label>
            <div class="layui-input-block">
                <input name="position" value='{$vo.position|default=""}' required placeholder="请输入位置"
                       class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">ip地址</label>
            <div class="layui-input-block">
                <input name="ip" value='{$vo.ip|default=""}' required placeholder="请输入ip地址"
                       class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">技能</label>
            <div class="layui-input-block">
                <input name="skill" value='{$vo.skill|default=""}' required placeholder="请输入技能"
                       class="layui-input">
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">门店</label>
            <div class="layui-input-block">
                <select name="shop_id" lay-filter="distributor" lay-search required>
                    <option value="">请选择</option>
                    {volist name="distributor" id="v"}
                    <option value="{$key}" {if isset($vo.shop_id) && $key== $vo.shop_id} selected {/if}>{$v}</option>
                    {/volist}
                </select>
                <p class="help-block"></p>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入备注" name="remark" class="layui-textarea"></textarea>
                <p class="help-block"></p>
            </div>
        </div>
    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit' id="submitBtn">保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>
</form>
<script>
    form.render();
    $('#submitBtn').click(function () {
        let shop_id = $('#submit-form select[name="shop_id"]').val();
        if (!shop_id) {
            layer.msg('请选择门店', {time: 1000});
            return false;
        }
    })
</script>



